// eslint-disable-next-line @typescript-eslint/no-var-requires
const { Sequelize, Model, DataTypes } = require('sequelize')
const sequelize = new Sequelize('sqlite::memory:')

class User extends Model { }
User.init({
  username: DataTypes.STRING
}, { sequelize, modelName: 'user' })

//sequelize提供了相同的语法(api) 统一了各种不同sql之间的区别
sequelize.sync()
  .then(() => User.create({
    username: 'ahhh'
  }))
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
  .then((result: { toJSON: () => any }) => {
    console.log(result.toJSON())
  })
